package playn.game.core;

import java.util.ArrayList;

import playn.core.Layer;
import playn.core.SurfaceLayer;

public class Camera {
	private float x=0;
	private float y=0;
	private float x_new=0;
	private float y_new=0;

	private ArrayList<SurfaceLayer> layers=new ArrayList<SurfaceLayer>();
	
	//protected SurfaceLayer staticLayer;
	
	public Camera(SurfaceLayer layer){
		layers.add(layer);
//		staticLayer=layer;
//		System.out.println("static");
	}
	
	public void setPosition(float x, float y) {
		this.x_new=x;
		this.y_new=y;
	}

	public void update(){
		for(Layer layer:layers){
			x=(x_new+x*20)/21;
			y=(y_new+y*20)/21;
			layer.setTranslation(-x, -y);
		}
	}

}
